package com.qfmy.controller.common;

import com.qfmy.service.common.WeatherService;
import com.qfmy.vo.common.WeatherVo;
import common.result.Result;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 清风明月
 * @Package com.qfmy.controller.common
 * @date 2025/5/18
 * @description 天气
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/weather")
public class WeatherController {

    /**
     * 注入service
     */
    @Resource
    private WeatherService weatherService;

    /**
     * 获取天气
     */
    @RequestMapping("/getWeather")
    public Result<WeatherVo> getWeather(){
        WeatherVo weather =  weatherService.getWeather();
        return Result.ok(weather);
    }

    /**
     * 获取一周的数据
     */
    @RequestMapping("/getWeekWeather")
    public Result<List<WeatherVo>> getWeekWeather(){
        List<WeatherVo> weather =  weatherService.getWeekWeather();
        return Result.ok(weather);
    }

}
